package mongodb

import "gopkg.in/mgo.v2/bson"

type CameraZone struct {
	Id        string `bson:"Id"`
	DeviceId  string `bson:"DeviceId"`
	ZoneId    int    `bson:"ZoneId"`
	ZoneClass string `bson:"ZoneClass"`
}

func (connect *Connect) FindCameraZoneByDeivceId(deviceId string) (*[]CameraZone, error) {
	c := connect.DataBase.C("D_CameraZone")
	var result []CameraZone
	err := c.Find(bson.M{"DeviceId": deviceId}).All(&result)
	return &result, err
}

func (connect *Connect) FindCameraZoneById(id string) (*CameraZone, error) {
	c := connect.DataBase.C("D_CameraZone")
	var result CameraZone
	err := c.Find(bson.M{"Id": id}).One(&result)
	return &result, err
}
